package com.wanmait.zaisousuo.filter;


import com.wanmait.zaisousuo.util.SysContext;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

@WebFilter("/backstage/*")
public class ContextFilter implements Filter {

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        HttpServletRequest req = (HttpServletRequest) request;
        SysContext.setRequest(req);
        chain.doFilter(request,response);
        SysContext.clear();
    }
}
